var QQMapWX = require('/utils/qqmap-wx-jssdk.min.js');
App({
	onLaunch: function () {
		this.globalData.myAmap = new QQMapWX({key:'2LEBZ-U44CP-LLPDE-VAITC-3BDG6-B6FOR'});
		this.getAdress();
		// this.getAllCity();
	},
	globalData: {
		city:'',
		myAmap:''
	},
	getAdress: function () {
		wx.getLocation({
			type: 'wgs84',
			success:(res)=>{
				this.globalData.myAmap.reverseGeocoder({
					location:{
						latitude: res.latitude,
        				longitude: res.longitude
					},
					success:data=>{
						const city = data.result.ad_info.city;
						this.globalData.city = city;
						if(this.cityCallback){
							this.cityCallback(city)
						}
					}
				})
			}
		})
	},
	getAllCity: function () {
		this.globalData.myAmap.getCityList({
			success:data=>{
				console.log(data)
			}
		})
	}
})